/**
 * @author vidy3587@gmail.com
 */
import VueRouter from "vue-router";
import Vue from "vue";
import {HostRoute} from "@/pages/host-routes";


Vue.use(VueRouter);



export const router = new VueRouter({
    routes:HostRoute,
    mode: 'history',
    scrollBehavior(to, from, savedPosition) {
        if (to.hash) { //先判断目标路由有没有hash值
            return {selector: to.hash}
        }
        if (savedPosition) {
            return savedPosition;
        }
        return {x: 0, y: 0};
    }
});
